package demo6;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何华树
 * Date: 2024-09-03
 * Time: 13:18
 */
public class obj{

    public static void main(String[] args) {
        //比较两个对象的内容信息是否一样。
        Dog dog1 = new Dog("旺财",10);
        Dog dog2 = new Dog("旺财",10);
//        System.out.println(dog1 == dog2);//仅仅只是比较地址的
        System.out.println(dog1.equals(dog2));

        //想要返回一样的 hash数，就必须重写 hashCode方法，重新定义新规则。
        System.out.println(dog1.hashCode());
        System.out.println(dog2.hashCode());
    }
}
